package stdio.costa.imoca.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@NamedQueries({
		@NamedQuery(name = "findActivityByUuid", query = "from Activity a where a.uuid =:uuid"),
		@NamedQuery(name = "findAllActivities", query = "from Activity") })
public class Activity extends UuidEntity implements Serializable {

	private static final long serialVersionUID = -6797550429265279980L;

	/*
	 * property start
	 */
	private String name;

	@Column(name = "start_time")
	private Date startTime;

	@Column(name = "end_time")
	private Date endTime;

	private String description;

	@OneToMany
	@XmlTransient
	private List<PostcardBack> postcardBacks; 

	/*
	 * property end
	 */

	public Activity() {
		super();
	}

	public Activity(String name, Date startTime, Date endTime,
			String description) {
		this(name, startTime, endTime, description, null);
	}

	public Activity(String name, Date startTime, Date endTime,
			String description, List<PostcardBack> postcardBacks) {
		this.name = name;
		this.startTime = startTime;
		this.endTime = endTime;
		this.description = description;
		this.postcardBacks = postcardBacks;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<PostcardBack> getPostcardBacks() {
		return postcardBacks;
	}

	public void setPostcardBacks(List<PostcardBack> postcardBacks) {
		this.postcardBacks = postcardBacks;
	}
}
